<template>
  <a-dropdown>
    <a class="ant-dropdown-link" @click="(e) => e.preventDefault()">
      {{userInfo.name}}<a-icon type="down" />
    </a>
    <a-menu slot="overlay">
      <a-menu-item>
        <router-link :to="'/mydji'">我的账号</router-link>
      </a-menu-item>
      <a-menu-item>
        <router-link :to="'/mydji'">我的订单</router-link>
      </a-menu-item>
      <a-menu-divider />
      <a-menu-item>
        <a @click="signOutClick">退出</a>
      </a-menu-item>
    </a-menu>
  </a-dropdown>
</template>

<script>
import {logout} from '../assets/js/request.js'
import {mapState,mapActions} from 'vuex'
export default {
    computed:{
        ...mapState('loginInfo',['userInfo'])
    },
    methods:{
        ...mapActions('loginInfo',['signOut']),
        signOutClick() {
            this.signOut()
            this.$router.push('/account')
            // if(res === undefined){
                // localStorage.removeItem('token')
            // }
        }
    },
};
</script>

<style lang="scss" scoped>

</style>